﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections.Specialized;

namespace GooglePlugin
{
    public partial class frmConfig : Form
    {
        public bool Enabled;
        public bool PCClock;
        public string AuthString;
        public string UserId;
        public string DeviceId;
        public string Variable;
        public decimal Interval;

        public frmConfig(NameValueCollection current)
        {
            InitializeComponent();
            try
            {
                chkEnabled.Checked = bool.Parse(current["googleplugin_enabled"]);
                nudInterval.Value = decimal.Parse(current["googleplugin_update_interval"]);
                chkPcClock.Checked = bool.Parse(current["googleplugin_usepcclock"]);
                txtAuthString.Text = current["googleplugin_authstring"];
                txtUserId.Text = current["googleplugin_userid"];
                txtDeviceId.Text = current["googleplugin_deviceid"];
                txtVariable.Text = current["googleplugin_variable"];
            }
            catch
            {
                // ignore
            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            Enabled = chkEnabled.Checked;
            PCClock = chkPcClock.Checked;
            AuthString = txtAuthString.Text;
            UserId = txtUserId.Text;
            DeviceId = txtDeviceId.Text;
            Variable = txtVariable.Text;
            Interval = nudInterval.Value;
        }

    }
}
